home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun: Productivity Pak 1 / rerun-productivity-pak-i.d64 / disk master (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  11KB  |  319 lines

  1. 10 rem --------- disk master ---------
  2. 15 rem
  3. 20 rem      single vic-1541 disk
  4. 25 rem     on commodore-64 system
  5. 30 rem
  6. 35 rem          robert w. baker
  7. 40 rem  15 windsor dr, atco, nj 08004
  8. 45 rem
  9. 50 rem
  10. 55 rem          revised by:
  11. 60 rem
  12. 65 rem        carl f. musolff
  13. 70 rem        4805 s 550 west
  14. 75 rem       columbus, in 47201
  15. 80 rem
  16. 85 rem -------------------------------
  17. 90 :
  18. 100 poke56,127:poke55,255:clr:print"[147]please wait . . .[146]":gosub3050
  19. 110 c$="":s$=c$:x=.:y=.
  20. 120 cr$=chr$(13):hc$=chr$(147):rv$=chr$(18):rf$=chr$(146):cl$=chr$(157)
  21. 150 gosub2140:dimd$(230),x$(230)
  22. 160 print"   reading directory cross reference"
  23. 170 open15,8,15,"i0":gosub2220
  24. 180 open5,8,5,"0:disk dir xref,s,r"
  25. 190 input#15,en,em$,et,es:ifen=62then290
  26. 200 input#5,x$(nx):ss=st:gosub2220:nx=nx+1:ifss=0then200
  27. 210 goto290
  28. 220 s$="":forx=1toy:gosub260:s$=s$+c$:nextx:return
  29. 230 forx=1toy:gosub260:nextx:return
  30. 240 v=.:gosub260:ifc$<>""thenv=asc(c$)
  31. 250 return
  32. 260 get#5,c$
  33. 270 ss=st:input#15,en,em$,et,es:ifen=0thenreturn
  34. 280 printhc$;rv$;"disk error!":print:goto2270
  35. 290 close4:close5:cx=.:gosub2140
  36. 300 printspc(5);"0 - done":print
  37. 310 printspc(5);"1 - update master directory":print
  38. 320 printspc(5);"2 - delete disk entry from master":print
  39. 330 printspc(5);"3 - display selected directory":print
  40. 340 printspc(5);"4 - find specified file":print
  41. 350 printspc(5);"5 - list disk id's and names"
  42. 360 gosub2150:print"enter desired function:  ";
  43. 370 gosub2120:ifc$="0"thenprinthc$:goto2380
  44. 380 v=val(c$):ifv<1orv>5then370
  45. 390 onvgoto400,1180,980,1690,1250
  46. 400 close15:cx=0:printhc$;"insert disk to be cataloged"
  47. 410 print:print"depress any key to continue, ";rv$;"q";rf$;" to quit"
  48. 420 gosub2120:ifc$="q"thengosub2390:goto290
  49. 430 gosub2150:print"ok":open15,8,15,"io":gosub270
  50. 440 open5,8,5,"$0,s,r":gosub270
  51. 450 sysmk:vf=peek(679):nb=peek(680)+peek(681)*256
  52. 460 dn$="":fori=0to15:dn$=dn$+chr$(peek(682+i)):nexti
  53. 470 di$="":fori=0to1:di$=di$+chr$(peek(698+i)):nexti
  54. 500 gosub2160:ifc$="n"then970
  55. 510 ifnx=0then630
  56. 520 forx=0tonx-1:c$=left$(x$(x),2):ifdi$<c$then630
  57. 530 ifdi$<>c$thennextx:goto630
  58. 540 ifdn$=mid$(x$(x),3)then630
  59. 550 printhc$;rv$;"*** warning ***";rf$;"  this disk id: ";rv$;di$;rf$
  60. 560 print:print"disk name: ";rv$;dn$
  61. 570 print:print"is already cataloged with a different"
  62. 580 print:print"disk name: ";rv$;mid$(x$(x),3):gosub2150
  63. 590 print"cataloging this disk will delete the"
  64. 600 print:print"previous data!":gosub2150
  65. 610 print"catalog this disk";:gosub2190:ifc$="n"then970
  66. 620 printhc$;"cataloging disk with new disk name"
  67. 630 gosub2150:print"reading directory entries ..."
  68. 635 fb=ws:w1=int(ws/256):poke254,w1:poke253,ws-w1*256
  69. 640 sysmj:df$=chr$(peek(702))+chr$(peek(703))
  70. 650 ifvf=1thendf$=" 1"
  71. 660 nf=.:ix=1:xf=peek(700):ifxf<1then850
  72. 670 f9=peek(fb):iff9<129then840
  73. 680 f$=chr$(f9):s$="":forj=1to18:s$=s$+chr$(peek(fb+j)):nextj
  74. 710 ifnf=.then740
  75. 720 forx=1tonf:ifleft$(s$,16)<mid$(d$(x),2,16)then750
  76. 730 next x
  77. 740 x=nf+1:goto760
  78. 750 fory=nftoxstep-1:d$(y+1)=d$(y):nexty
  79. 760 d$(x)=f$+s$:nf=nf+1
  80. 780 ifnf<155then840
  81. 790 printhc$;spc(6);rv$;"*** disk bam is invalid ***";rf$:gosub2150
  82. 800 print:print"   current disk cannot be cataloged!":print:print:print
  83. 810 print" please verify or check disk contents":print
  84. 820 print"before attempting to catalog this disk.":print
  85. 830 gosub2150:gosub2110:goto970
  86. 840 fb=fb+19:ix=ix+1:ifix<xf+1then670
  87. 850 close5:gosub2390:gosub2150:print"updating master directory ..."
  88. 860 ifnx=.then910
  89. 870 forx=0tonx-1:c$=left$(x$(x),2):ifdi$<c$then900
  90. 880 ifdi$=c$then930
  91. 890 nextx:goto910
  92. 900 fory=nx-1toxstep-1:x$(y+1)=x$(y):nexty:goto920
  93. 910 x=nx
  94. 920 nx=nx+1
  95. 930 x$(x)=di$+dn$:cx=1
  96. 940 gosub2030:print#15,"s"+s$:open5,8,5,s$+",s,w":gosub270
  97. 950 print#5,df$;",";nb;cr$;:gosub270
  98. 960 ifnf>.thenforx=1tonf:print#5,d$(x);cr$;:gosub270:nextx
  99. 970 close5:gosub2290:goto400
  100. 980 printhc$;"to display disk directory":gosub1870:onvgoto290,980
  101. 990 open5,8,5,s$+",s,r":gosub270:gosub2070:input#5,df$,nb:gosub270
  102. 1000 print#4,"  ";rv$;"disk name:";rf$;"  ";dn$:print#4
  103. 1010 print#4,""spc(4);rv$;"disk id:";rf$;"  ";di$;spc(6)
  104. 1020 print#4,rv$;"disk format:"rf$;"  "df$:print#4
  105. 1030 print#4,rv$;"blocks free:";rf$;" ";nb:print#4
  106. 1040 print#4,"---------------------------------------":print#4
  107. 1050 nf=.:ifss>.then1160
  108. 1055 w1=int(ws/256):poke254,w1:poke253,ws-w1*256
  109. 1060 sysmi:gosub260:ft=peek(ws):s$="":fori=1to16:s$=s$+chr$(peek(ws+i)):nexti
  110. 1065 z=peek(ws+17):v=peek(ws+18)
  111. 1070 print#4,right$("    "+str$(z+(256*v)),4);"  ";s$;"  ";
  112. 1080 ifft=129thenprint#4,"seq";
  113. 1090 ifft=130thenprint#4,"pgm";
  114. 1100 ifft=131thenprint#4,"usr";
  115. 1110 ifft=132thenprint#4,"rel";
  116. 1120 print#4:getc$:ifc$<>""thengosub2120
  117. 1130 ifc$="q"then1170
  118. 1140 nf=nf+1:ifss=.then1060
  119. 1150 print#4:print#4,rv$;"#files:";rf$;" ";nf
  120. 1160 ifpd=3thengosub2150:gosub2110
  121. 1170 close4:close5:goto980
  122. 1180 printhc$;"to delete disk from master directory"
  123. 1190 gosub1870:onvgoto1240,1180
  124. 1200 print#15,"s"+s$
  125. 1210 cx=.:forx=0tonx-1:ifleft$(x$(x),2)=di$thencx=1
  126. 1220 ifcxthenx$(x)=x$(x+1)
  127. 1230 next:nx=nx-1:goto1180
  128. 1240 gosub2290:goto290
  129. 1250 ifnx=.thengosub1880:goto290
  130. 1260 close4:gosub2140
  131. 1270 printspc(5);"0 - return to main function menu":print
  132. 1280 printspc(5);"1 - print full id usage chart":print
  133. 1290 printspc(5);"2 - quick list of id's in use":print
  134. 1300 printspc(5);"3 - list disk id's & names":print
  135. 1310 printspc(5);"4 - list ";rv$;"min";rf$;" free blocks per disk":print
  136. 1320 printspc(5);"5 - list ";rv$;"max";rf$;" free blocks per disk"
  137. 1330 gosub2150:print"enter desired function:  ";
  138. 1340 gosub2120:ifc$="0"then290
  139. 1350 v=val(c$):ifv<1orv>5then1340
  140. 1360 printc$:onvgoto1370,1550,1620,2450,2490
  141. 1370 open4,4
  142. 1380 print#4,""spc(15);rv$;"  d i s k   i d   u s a g e   c h a r t  "
  143. 1390 print#4:print#4," ";
  144. 1400 forx=48to90:ifx=58thenx=65
  145. 1410 print#4," ";chr$(x);:nextx:print#4
  146. 1420 z=.:forx=48to90:ifx=58thenx=65
  147. 1430 print#4," [219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219][192][219]";
  148. 1440 print#4,"[192][219][192][219][192][219][192][219][192][219][192][179]"
  149. 1450 print#4,chr$(x);
  150. 1460 fory=48to90:ify=58theny=65
  151. 1470 print#4,chr$(221);:ifz=nxthen1500
  152. 1480 c$=chr$(x)+chr$(y):s$=left$(x$(z),2)
  153. 1490 ifs$=c$thenprint#4,chr$(166);:z=z+1:goto1510
  154. 1500 print#4," ";
  155. 1510 next y:print#4,chr$(221):getc$:ifc$<>""thengosub2120
  156. 1520 ifc$<>"q"thennextx
  157. 1530 print#4," [177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177][192][177]";
  158. 1540 print#4,"[192][177][192][177][192][177][192][177][192][177][192][189]":goto1260
  159. 1550 gosub2070:print#4,""spc(7);"disk id's currently in use"
  160. 1560 print#4:print#4
  161. 1570 v=12:ifpd=4thenv=25
  162. 1580 z=.:forx=0tonx-1:print#4,left$(x$(x),2);" ";
  163. 1590 z=z+1:ifz=int(z/v)*vthenprint#4
  164. 1600 nextx:print#4:print#4:ifz<>int(z/v)*vthenprint#4
  165. 1610 print#4,z;rv$;"disks in master directory":goto1670
  166. 1620 gosub2070:print#4,rv$;"id  ...disk name....":print#4
  167. 1630 forx=0tonx-1:print#4,left$(x$(x),2);"  ";mid$(x$(x),3)
  168. 1640 getc$:ifc$<>""thengosub2120
  169. 1650 ifc$="q"then1260
  170. 1660 nextx
  171. 1670 ifpd=4then1260
  172. 1680 gosub2150:gosub2110:goto1260
  173. 1690 ifnx=.thengosub1880:goto290
  174. 1700 close4:printhc$;"to find what disk(s) a file is on":print
  175. 1710 print"enter file name   .";cl$;cl$;cl$;:inputf$:iff$="."then290
  176. 1720 iff$="*"thenprint:print"re-";:goto1710
  177. 1725 w1=int(ws/256):poke254,w1:poke253,ws-256*w1
  178. 1730 s$=f$:gosub2040:v=y:gosub2070:pokemp,v+1
  179. 1735 f1$="0"+f$+"0":forf1=2tov+1:pokewf+f1-1,asc(mid$(f1$,f1,1)):nextf1
  180. 1740 print#4,rv$;"...file name....  id  ...disk name....":print#4
  181. 1750 print#4,s$:print#4
  182. 1760 forz=0tonx-1:di$=left$(x$(z),2):dn$=mid$(x$(z),3)
  183. 1770 gosub2030:open5,8,5,s$+",s,r":ef=15:gosub270:input#5,df$,nb:gosub270
  184. 1780 sysml:p2=peek(2)+1:onp2goto1810,1790,1810,1790
  185. 1790 s$="":fori=1to16:s$=s$+chr$(peek(ws+i)):nexti
  186. 1800 print#4,s$;"  ";di$;"  ";dn$:rem <- 2 spaces ea
  187. 1810 getc$:ifc$<>""thengosub2120
  188. 1820 ifc$="q"thenclose5:goto1700
  189. 1830 onp2goto1840,1780,1840,1840
  190. 1840 clo